package com.nxk.modules.exception;

public class ResultEntity {

    private String code;
    private String msg;
    private Object data;

    public static ResultEntity success() {
        return new ResultEntity(RequestStatus.SUCCESS.getCode(), RequestStatus.SUCCESS.getMessage(), null);
    }

    public static ResultEntity success(String msg) {
        return new ResultEntity(RequestStatus.SUCCESS.getCode(), msg, null);
    }

    public static ResultEntity success(String msg, Object data) {
        return new ResultEntity(RequestStatus.SUCCESS.getCode(), msg, data);
    }

    public static ResultEntity success(Object data) {
        return new ResultEntity(RequestStatus.SUCCESS.getCode(), RequestStatus.SUCCESS.getMessage(), data);
    }


    public static ResultEntity success(String code, String msg, Object data) {
        return new ResultEntity(code, msg, data);
    }


    public static ResultEntity fail(String msg) {
        return new ResultEntity(RequestStatus.ERROR_REQUEST.getCode(), msg, null);
    }


    public static ResultEntity fail(String code, String msg) {
        return new ResultEntity(code, msg, null);
    }


    public static ResultEntity fail() {
        return new ResultEntity(RequestStatus.SUCCESS.getCode(), "fail", null);
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public ResultEntity(String code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public ResultEntity() {
    }

}
